#ifndef __MSGERROR_H
#define __MSGERROR_H

#include "OutputMessage.h"
#include "BasicTypes.h"
#include <memory>

class Model;

class IErrorData
{
public:
	virtual ~IErrorData() {};
	virtual std::string Serialize() = 0;
};

class MsgError : public IOutputMessage
{
	friend class MsgSetDecodeFormat;
	friend class MsgDecodeRequest;
	friend class MsgSetFilter;
	friend class MsgMatchRequest;
	friend class MsgSetOption;
    friend class MsgAddTableEntry;

public:
	virtual ~MsgError() {};
	virtual std::string Message() const;
private:
	MsgError(ErrorCode errorCode, const Model & model, IErrorData * errorData) : m_model(model), m_errData(errorData)
	    { m_ErrorCode = errorCode; };
	ErrorCode m_ErrorCode;
	std::auto_ptr<IErrorData> m_errData;
	const Model & m_model;
};

#endif //__MSGOK_H